//
//  AccountViewController.m
//  DirectProDuct
//
//  Created by hl on 16/1/22.
//  Copyright (c) 2016年 ping. All rights reserved.
//

#import "AccountViewController.h"
#import "BaseInfomationViewController.h"
#import "EditPassWordViewController.h"
#import "ChangePhoneViewController.h"
@interface AccountViewController ()

@end

@implementation AccountViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self drawNavWithTitle:@"账户设置"];
    [self drawBackButton];
    [self drawView];
    // Do any additional setup after loading the view.
}
-(void)drawView{
    NSArray *titleArr = @[@"基 本 信 息",@"修 改 密 码",@"手 机 绑 定"];
    NSArray *colorArr = @[RGBACOLOR(255, 180, 0, 1),RGBACOLOR(0, 130, 64, 1),RGBACOLOR(0, 173, 164, 1)];
    for (int i = 0; i<titleArr.count; i++) {
        UIButton *btn = [self createdButtonWithTitle:[titleArr objectAtIndex:i] andIndex:i andColor:(UIColor *)[colorArr objectAtIndex:i]];
        [btn addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
    }
}
-(UIButton *)createdButtonWithTitle:(NSString *)titleStr andIndex:(int)index andColor:(UIColor *)backcolor{
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(47 * _kscW,78 + 40 * _kscH + 57 * _kscH * index, KScreenWidth - 47 * _kscW * 2, 30 * _kscH)];
    btn.tag = index;
    [btn setTitle:titleStr forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont fontWithName:TextJiaCu size:16.0];
    btn.backgroundColor = backcolor;
    btn.layer.cornerRadius = 4;
    btn.clipsToBounds = YES;
    return btn;
}
-(void)clicked:(UIButton *)btn{
    
    if (btn.tag == 0) {
        BaseInfomationViewController *base = [[BaseInfomationViewController alloc] init];
        [self.navigationController pushViewController:base animated:YES];
    }else if (btn.tag == 1){
        EditPassWordViewController *edit = [[EditPassWordViewController alloc] init];
        [self.navigationController pushViewController:edit animated:YES];
    }else if (btn.tag == 2){
        ChangePhoneViewController *change = [[ChangePhoneViewController alloc] init];
        [self.navigationController pushViewController:change animated:YES];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
